<?php

declare(strict_types=1);

namespace App\Dao;

use App\Actions\ChatAction;
use App\Job\AutoAdReturnQueueJob;
use App\Job\OppoAdDataReturnQueueJob;
use App\Model\Anchor;
use App\Model\AnchorEvaluate;
use App\Model\AppUpgrade;
use App\Model\AuditIp;
use App\Model\Banner;
use App\Model\ChatConfig;
use App\Model\Fate;
use App\Model\Level;
use App\Model\Order;
use App\Model\User;
use App\Model\UserChange;
use App\Model\UserChatLimit;
use App\Model\UserFirstAccost;
use App\Model\UserIdentity;
use App\Model\UserSuperVip;
use App\Model\UserTease;
use App\Model\UserVip;
use App\Services\JwtService;
use App\Services\Queue\QueueService;
use App\Utils\FunUtil;
use App\Utils\LoggerUtil;
use App\Utils\MemcacheClient;
use Hyperf\Context\ApplicationContext;
use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use stdClass;
use function Hyperf\Translation\trans;

class UserTeaseDao
{
    private static $instance;

    public static function getInstance()
    {
        if (!self::$instance) {
            self::$instance = Applicationcontext::getcontainer()->get(self::class);
        }
        return self::$instance;
    }

    /**
     * Note - 保存搭讪记录
     * DateTime 2024/7/19 11:48
     * User Admin
     * @param $uid
     * @param $user_id
     * @param null $accostType
     * @return array
     */
    public function recordTease($uid, $user_id, $accostType = null, $src = 0)
    {
        UserTease::query()->updateOrInsert(['uid' => $uid, 'user_id' => $user_id, 'src' => $src], ['ctime' => time()]);
        if (!empty($accostType)) {
            (new UserFirstAccost())->recordFirstAccost($uid, $user_id, $accostType);// $accostType: 1一键搭讪  2手动搭讪  3红线  4主页私信  5上线私信
        }
    }


}